import { getAreaObj } from '@/utils/util'
let applyStatus = [
	{ label: '待申请', value: 0, type: 'primary' },
	{ label: '待审核', value: 1, type: 'primary' },
	{ label: '初审通过', value: 2, type: 'warning' },
	{ label: '复审通过', value: 3, type: 'success' },
]
let dataType = [
	{ label: '机构运营补贴', value: 1, type: 'success' },
	{ label: '新增床位补贴', value: 2, type: 'success' },
]
const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{
			label: '区划',
			prop: 'areaName',
		},
		{
			label: '养老机构',
			prop: 'orgName',
		},
		{
			label: '申请类别',
			prop: 'dataType',
			custome: 'tag',
			dicData: dataType,
		},
		// {
		// 	label: '申请年月',
		// 	prop: '',
		// },
		// {
		// 	label: '申请全额',
		// 	prop: '',
		// },
		{
			label: '申请状态',
			prop: 'applyStatus',
			type: 'select',
			custome: 'tag',
			dicData: applyStatus,
		},
		{
			label: '更新时间',
			prop: 'updateTime',
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}
const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '所属区划',
			prop: 'areas',
			propName: 'areasName',
			type: 'AplidAreaSelect',
			regionGrade: 3,
			checkStrictly: false,
			span: 8,
		},
		{
			label: '养老机构',
			prop: 'orgName',
			type: 'input',
			span: 8,
		},
		{
			label: '申请类别',
			prop: 'dataType',
			type: 'select',
			dicData: dataType,
			span: 8,
		},
		// {
		// 	label: '申请年月',
		// 	prop: 'oldman',
		// 	type:'dateTime',
		// 	format:'YYYY年MM月DD日 HH:mm:ss',
		// 	valueFormat:'YYYY-MM-DD HH:mm:ss',
		// 	span:8
		// },
		{
			label: '申请状态',
			prop: 'applyStatus',
			type: 'select',
			dicData: applyStatus,
			span: 8,
		},
	],
}
export const baseConfig: any = {
	pageName: '宁企通补贴审批',
	addLabel: '添加',
	dictcodes: ['SUBSIDY_TYPE'],
	rowKey: 'id',
	tipLabel: 'orgName',
	api: {
		index: 'view_nqtApplyInfo_page',
		delete: 'view_nqtApplyInfo_del',
	},
	auth: {
		index: 'view_nqtApplyInfo_page',
		delete: 'view_nqtApplyInfo_del',
	},

	menuBtn: [
		{
			icon: 'detail',
			label: '详情',
			type: 'primary',
			operate: 'Detial',
			auth: '',
			text: true,
			show: true,
		},
		{
			icon: 'delete',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: 'view_nqtApplyInfo_del',
			text: true,
			show: true,
		},
	],
	dialogConfig: {
		width: '65%',
	},
	searchConfig,
	tableConfig,
	beforeOnLoadFormate: async (params) => {
		const areasObjName: any = getAreaObj(params.areasName, '')
		return Promise.resolve({
			...params,
			areaName: areasObjName.areaName,
			areasName: undefined,
			areas: undefined,
		})
	},
}
